﻿namespace Myotragus.Data.Tupples.Tests
{
	public class ImplementedCompositeKey
	{
		public string KeyField1 { get; set; }
		public int KeyField2 { get; set; }
		public int KeyField3 { get; set; }

		public override bool Equals(object obj)
		{
			return Equals(obj as ImplementedCompositeKey);
		}

		public bool Equals(ImplementedCompositeKey other)
		{ 
			if (other == null)
				return false;

			return (KeyField1 == null ? other.KeyField1 == null : KeyField1.Equals(other.KeyField1))
				&& KeyField2 == other.KeyField2 && KeyField3 == other.KeyField3;
		}

		public override int GetHashCode()
		{
			return (KeyField1 == null ? 0 : KeyField1.GetHashCode()) ^ KeyField2 ^ KeyField3;
		}
	}
}
